<div id="result">
<div class="div_header1" style="float: none;">Add New Page</div>
    <form accept-charset="utf-8" action="<?php echo Configure::read('base_url');?>cmspages/add" method="post" id="productmessage">
<table cellspacing="0" >
             <tbody>
                <tr>
                     <td colspan="2">
                        Page Title:
                     </td>
                 </tr>
                 <tr>
                     <td class="tddata" colspan="2">
                         <?php
                         //echo $this->Form->input('id');
                         echo $this->Form->input('Cmspage.title',array('div'=>false,'label'=>false,'type'=>'text','size'=>45,'class'=>'required'));
                         ?>
                     </td>

                 </tr>
                 <tr>
                     <td colspan="2">
                        Page Listed Under:
                     </td>
                 </tr>
                 <tr>
                     <td class="tddata" colspan="2">
                       <?php
                         $options=array('About Us'=>'About Us','User Agreement'=>'User Agreement');
                          echo $this->Form->select('Cmspage.listed_under',$options,null,array('div'=>false,'label'=>false,'empty'=>'--Select--','class'=>'required'));
                         ?>
                     </td>

                 </tr>
                 <tr>
                     <td colspan="2">
                         Page Enabled:
                     </td>
                 </tr>
                 <tr>
                     <td class="tddata" colspan="2">
                            <?php
                         $options=array('Enabled'=>'Yes','Disable'=>'No');
                          echo $this->Form->select('Cmspage.status',$options,null,array('div'=>false,'label'=>false,'empty'=>false,'class'=>'required'));
                         ?>
                     </td>

                 </tr>
                 <tr>
                     <td colspan="2">
                        Page Content:
                     </td>
                 </tr>
                 <tr>
                     <td class="tddata" colspan="2">
                         <?php echo $form->textarea('Cmspage.content', array('cols' => '85', 'rows' => '15','class'=>'fckrequired'));?>
			<?php echo $fck->load('Cmspage.content', 'Custom');?>
                     </td>

                 </tr>
                 <tr>
                    <td colspan="2">
                    <input type="submit" style="background:#73AE0B; color:#fff; font-size:14px;" name="button" id="button" value="add" />
                    </td>
                  </tr>
                    </tbody>
                </table>
</form>
</div>
<?php  echo $html->script(array("jquery.min.js","jquery.form.js","jquery.validate.js", "jquery.tablesorter.min.js", "jquery.tablednd.js")); ?>
<script type="text/javascript">
 jQuery(document).ready(function(){
     
     jQuery.validator.addMethod("fckrequired", function (value, element) {
        var oEditor = FCKeditorAPI.GetInstance('CmspageContent') ;
        var pageValue = oEditor.GetHTML(true);
        pageValue=jQuery.trim(pageValue);
        if ( pageValue == "<br />" || pageValue == "") {
            return false;
        }else{
            return true;
        }
    }, "This field is required.");

// show a simple loading indicator
		var loader = jQuery('<div id="loader"><img src="<?php echo Configure::read('base_url');?>img/loading.gif" alt="loading..." /></div>')
			.css({position: "relative", top: "1em", left: "25em"})
			.appendTo("body")
			.hide();
		jQuery().ajaxStart(function() {
			loader.show();
		}).ajaxStop(function() {
			loader.hide();
		}).ajaxError(function(a, b, e) {
			throw e;
		});

		var v = jQuery("#productmessage").validate({
                    rules: {
                    },
      submitHandler: function(form) {
				jQuery(form).ajaxSubmit({
					target: "#result"
				});
			}
		});


                 });
 </script>